package mosquito.g7.strategy;

import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.Set;

import mosquito.sim.Collector;
import mosquito.sim.Light;

public abstract class Strategy {

    protected ArrayList<ArrayList<Point2D.Double>> placedLights;

    private void ensureSizeOfPPL(int index) {
        while(index >= placedLights.size()) // grow to correct size if necessary
            placedLights.add(new ArrayList<Point2D.Double>());
    }
    
    protected void addLightToNthChainFromCollector(Point2D.Double lightPosition, int lightsFromCollector) {
        ensureSizeOfPPL(lightsFromCollector);
        placedLights.get(lightsFromCollector).add(lightPosition);
    }
    
    protected ArrayList<Point2D.Double> getLightsFromNthChainFromCollector(int lightsFromCollector) {
        ensureSizeOfPPL(lightsFromCollector);
        return placedLights.get(lightsFromCollector);
    }
        
    protected int maxLightsFromCollector() {
        return placedLights.size(); // TODO: check math
    }
    
    public Strategy() {
        placedLights = new ArrayList<ArrayList<Point2D.Double>>();

    }
    
    public abstract Set<Light> getLights(int numberOfLights);
    public abstract Collector getCollector();
    
}
